﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;

namespace PRGexample.Controllers
{
    public class HomeController : Controller
    {
		static List<string> quotes = new List<string>();
        public ActionResult Index(string quote)
        {
			if(!string.IsNullOrEmpty(quote))
			{
				if(this.IsSavedSuccessfuly())
				{
					ViewBag.Success = " ";
					quotes.Add(quote);
				}
				else
				{
					ViewBag.Failure = " ";
				}
				
			}
            return View(quotes);
        }

		public ActionResult Add()
		{
			return View();
		}

		private bool IsSavedSuccessfuly()
		{
			Random rand = new Random();

			return rand.NextDouble() >= 0.5;
		}
    }
}